/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/05/03
*/
#ifndef __EDUI_IRENDER_H__
#define __EDUI_IRENDER_H__

#include "../core/Base.h"

EDUI_NAMESPACE_BEGIN

class IWindow;
class IFont;
class ITexture;
class ISurface;

class EDUI_API IRender
{
public:
	virtual bool Create(IWindow* wnd, int index = -1, RendererFlags flags = RENDERER_ACCELERATED) = 0;
	virtual bool IsOK() = 0;
    virtual void Destroy() = 0;
 	virtual Size GetSize() = 0;

    virtual void Clear(const Color* color = 0) = 0;
	virtual void Present(const Rect* rc) = 0;

	virtual bool SetBlendMode(BlendMode mode) = 0;
	virtual BlendMode GetBlendMode() = 0;

	virtual bool SetTarget(ITexture* texture) = 0;
	virtual ITexture* GetTarget() = 0;

	virtual bool SetColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) = 0;
	virtual bool SetColor(const Color* color) = 0;
    virtual Color GetColor() = 0;

	virtual bool SetScale(float scaleX, float scaleY) = 0;
	virtual PointF GetScale() = 0;

	virtual bool SetClip(const Rect *rect) = 0;
	virtual Rect GetClip() = 0;
	virtual bool IsClipEnabled() = 0;

	virtual bool SetViewport(const Rect *rect) = 0;
	virtual Rect GetViewport() = 0;

    virtual void DrawPoint(int x, int y) = 0;
	virtual void DrawLine(int x1, int y1, int x2, int y2) = 0;
	virtual void DrawRect(const Rect * rect) = 0;
	virtual void DrawRect(int x1, int y1, int x2, int y2) = 0;
	virtual void FillRect(const Rect * rect) = 0;
	virtual void FillRect(int x1, int y1, int x2, int y2) = 0;

	virtual void DrawTexture(ITexture* texture, const Rect* src, const Rect* dst, int id = 0) = 0;
	virtual void DrawTexture(ITexture* texture, int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2, int id = 0) = 0;
	virtual void DrawScaleTexture(ITexture* texture, const Rect* src, const Rect* dst, const Rect1* corner, bool bHole = false, int id = 0) = 0;
	virtual void DrawMaskTexture(ISurface* img, ISurface* mask, const Rect* src, const Rect* dst, int id = 0) = 0;

	virtual void DrawText(const char* text, const Rect* rc, IFont* font, const Color* fg = 0) = 0;
	virtual void DrawText(const char* text, int x, int y, IFont* font, const Color* fg = 0) = 0;
	virtual void DrawWrappedText(const char* text, const Rect* rc, IFont* font, const Color* fg = 0) = 0;

	virtual IWindow* GetWindow() = 0;
};

EDUI_NAMESPACE_END

#endif